Let $A\to B$ be a surjective map of commutative $k$-algebras, and suppose $C\to B$ is a free resolution of $B$ as an $A$-algebra, meaning that $C$ is a free non-negatively graded commutative $A$-algebra with a differential decreasing degree by 1, and the map to $B$ is a quasi-isomorphism (e.g. $C$ might be a Koszul-Tate resolution). Let $d(C)$ denote the highest degree of a generator of $C$ over $A$, and let $d(B,A)$ be the smallest possible value of $d(C)$ over all such $C$; it is a kind of non-linear version of homological dimension.

I am particularly interested in the case when $A=C^\infty(M)$ and $B=C^\infty(S)$ for a closed embedding $S\hookrightarrow M$ of manifolds, in which case I denote the quantity above by $d(S,M)$. For instance, if $S$ is the zero locus of a generic section of a trivial vector bundle $E$ on $M$, $d(S,M)=1$ (just take the Koszul resolution), whereas if the bundle is not trivial but stably trivial, $d(S,M)=2$. In general, the value of $d$ is the higher the farther away $E$ is from being trivial, in a certain sense that can be made precise.

My question is, has this invariant been studied before, and if so, is there a formula expressing it in terms of some known topological invariants? I'd be happy with the case when $M$ is itself a vector bundle and $S$ the zero section.

*N.B.* Asking for $C$ to be merely projective over $A$ would yield a different value of $d$: e.g. one would have $d=1$ for the zero locus of a generic section of *any* vector bundle. In this case, higher values of $d$ would detect singularities.